package org.nanotek.base.music;

import java.util.Set;

import javax.persistence.Entity;
import javax.persistence.Id;

import org.nanotek.Base;
import org.nanotek.base.artist.Artist;

/**
 * refer -> http://musicbrainz.org/doc/Recording
 * 
 * @author josecanovamauger
 *
 */
@Entity
@SuppressWarnings("serial")
public class Record implements Base<Long>{

	@Id
	private Long id; 
	
	private String title; 
	
	private Set<Artist> participants; 
	
	private Set<Base<?>> attributes;  
	
	public Record() 
	{
	}
	
	public Record(Set<Base<?>> attributes) {
		super();
		this.attributes = attributes;
	}

	public Record(Set<Base<?>> attributes , Set<Artist> participants) {
		super();
		this.attributes = attributes;
		this.participants = participants;
	}

	@Override
	public Long getId() {
		return id;
	}

	@Override
	public void setId(Long id) {
		this.id = id;
	}

	public String getTitle() {
		return title;
	}

	public void setTitle(String title) {
		this.title = title;
	}

	public Set<Base<?>> getAttributes() {
		return attributes;
	}

	public void setAttributes(Set<Base<?>> attributes) {
		this.attributes = attributes;
	}

	public Set<Artist> getParticipants() {
		return participants;
	}

	public void setParticipants(Set<Artist> participants) {
		this.participants = participants;
	}

	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result + ((id == null) ? 0 : id.hashCode());
		result = prime * result + ((title == null) ? 0 : title.hashCode());
		return result;
	}

	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		Record other = (Record) obj;
		if (id == null) {
			if (other.id != null)
				return false;
		} else if (!id.equals(other.id))
			return false;
		if (title == null) {
			if (other.title != null)
				return false;
		} else if (!title.equals(other.title))
			return false;
		return true;
	}
	
	
}
